﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using BudgetManager.Data;
using BudgetManager.ViewModels;

namespace BudgetManager
{
    public partial class Reports : PhoneApplicationPage
    {
        public Reports()
        {
            InitializeComponent();
            this.Loaded += Reports_Loaded;
            //loadData();
        }

        void Reports_Loaded(object sender, RoutedEventArgs e)
        {
            var viewModel = new ExpenseReportViewModel();
            DataContext = viewModel;
        }

        //private void loadData()
        //{
        //    var expenses = new BudgetMgrDAL().LoadExpenses(null);
        //    //var datasource = from expense in expenses
        //    //                 select new { ExpenseDetails = string.Concat(expense.ExpenseAmount.ToString(), "\\-"), Description = expense.Comments, Date = ((DateTime)expense.ExpenseDate).Day, Month = ((DateTime)expense.ExpenseDate).ToString("MMM"), Year = ((DateTime)expense.ExpenseDate).Year, Category = expense.Category };
        //    var dataGroups = expenses.GroupBy(e => e.Category).Select(grp => new
        //    {
        //        Key = grp.Key,
        //        Items = grp 
        //    });
        //    foreach(var item in 
        //    expensesList.ItemsSource = expenses.ToList();
        //}

        private void filterBtnClicked(object sender, EventArgs e)
        {

        }

        private void clearFilterBtnClicked(object sender, EventArgs e)
        {

        }
    }
}